﻿#region Using Statements
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content.Pipeline;
using Microsoft.Xna.Framework.Content.Pipeline.Graphics;
using Microsoft.Xna.Framework.Content.Pipeline.Processors;
using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler;
using MilwormsGameData;
#endregion

namespace MilwormsGameContentPipeline
{
    [ContentTypeWriter]
    public class GameStartDescriptionWriter : MilwormsGameWriter<GameStartDescription>
    {
        protected override void Write(ContentWriter output, GameStartDescription value)
        {
            if (value.PlayerContentNames.Count <= 0)
            {
                throw new ArgumentException(
                    "The starting party must have at least one player in it.");
            }

            output.Write(value.MapContentName);
            output.WriteObject(value.PlayerContentNames);
            output.Write(value.QuestLineContentName);
        }

        public override string GetRuntimeType(TargetPlatform targetPlatform)
        {
            return typeof(MilwormsGameData.GameStartDescription).AssemblyQualifiedName;
        }

        public override string GetRuntimeReader(TargetPlatform targetPlatform)
        {
            return typeof(MilwormsGameData.GameStartDescription.GameStartDescriptionReader).AssemblyQualifiedName;
        }
    }
}
